[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
getcurdir() Get Current Directory
#include <dir.h>
int getcurdir(drive,direc);
int drive; Drive number
char *direc; Pointer to directory name
getcurdir() gets the name of the current working directory for
'drive'. 'drive' is a drive number, where 0 = default, 1 = A, and so
on. 'direc' is a pointer to the portion of memory where the
directory name will be stored. The area is of length MAXDIR. The
name is null-terminated; it does not contain the drive specification,
nor does it begin with a backslash.
Returns: 0 if successful; -1 on error.
Portability: MS-DOS only.
-------------------------------- Example ---------------------------------
The following statements print the name of the current directory
(without the drive specifier).
#include <stdio.h> /* for printf */
#include <dir.h> /* for getcurdir and MAXDIR */
main()
{
char dirname[MAXDIR];
getcurdir(0,dirname); /* 0 = default drive */
printf("The current directory is %s\n",dirname);
}
See Also:
getcwd()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson